#!/usr/bin/python
# -*- coding: UTF-8 -*-

"""
@author: andi
@contact: 643562684@qq.com
@time: 2022/5/31 17:59
"""

import pytest


def pytest_addoption(parser):
    """命令行下的解析器"""
    mygroup = parser.getgroup("test pattern")  # group 展示所有的option
    mygroup.addoption("--run_pattern",
                      default='run_pytest',
                      dest='test01',
                      help="Run the test case of unittest or pytest"
                      )


@pytest.fixture(scope='session')
def cmd_option(request):
    _env = request.config.getoption("--run_pattern")
    if _env == 'run_pytest':
        return True
    elif _env == "run_unittest":
        return False
